<?php
require 'autoload.php';
class Db {
    use \DesignPatterns\Traits\Singleton;

    protected $data = [];

    public function query()
    {
        echo "query from db";
    }

    public function setData($data)
    {
        $this->data = $data;
    }

    public function getData()
    {
        return $this->data;
    }
}

$db = Db::getInstance();
$db2 = Db::getInstance();

var_dump($db === $db2);
$db->setData('hello singleton');
var_dump($db2->getData());